package com.woniu.woniu_bx.filter;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * @Description token校验封装数据类
 * @Author leonie
 * @Date 2022/8/23 14:07
 */
public class JwtToken extends AbstractAuthenticationToken {
    private String token;

    public JwtToken(String token){
        super(null);
        this.token=token;
        setAuthenticated(false);
    }
    public JwtToken(String token, boolean authenticated, Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.token=token;
        this.setAuthenticated(authenticated);
    }

    @Override
    public Object getCredentials() {
        return token;
    }

    @Override
    public Object getPrincipal() {
        return token;
    }
}
